<!doctype html>
<html class="default no-js">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>ClassUtils | ts</title>
	<meta name="description" content="Documentation for ts">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
	<div class="tsd-page-toolbar">
		<div class="container">
			<div class="table-wrap">
				<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
					<div class="field">
						<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
						<input id="tsd-search-field" type="text" />
					</div>
					<ul class="results">
						<li class="state loading">Preparing search index...</li>
						<li class="state failure">The search index is not available</li>
					</ul>
					<a href="../index.html" class="title">ts</a>
				</div>
				<div class="table-cell" id="tsd-widgets">
					<div id="tsd-filter">
						<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
						<div class="tsd-filter-group">
							<div class="tsd-select" id="tsd-filter-visibility">
								<span class="tsd-select-label">All</span>
								<ul class="tsd-select-list">
									<li data-value="public">Public</li>
									<li data-value="protected">Public/Protected</li>
									<li data-value="private" class="selected">All</li>
								</ul>
							</div>
							<input type="checkbox" id="tsd-filter-inherited" checked />
							<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
							<input type="checkbox" id="tsd-filter-externals" checked />
							<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
							<input type="checkbox" id="tsd-filter-only-exported" />
							<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
						</div>
					</div>
					<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
				</div>
			</div>
		</div>
	</div>
	<div class="tsd-page-title">
		<div class="container">
			<ul class="tsd-breadcrumb">
				<li>
					<a href="../globals.html">Globals</a>
				</li>
				<li>
					<a href="../modules/_laya_utils_classutils_.html">&quot;laya/utils/ClassUtils&quot;</a>
				</li>
				<li>
					<a href="_laya_utils_classutils_.classutils.html">ClassUtils</a>
				</li>
			</ul>
			<h1>Class ClassUtils</h1>
		</div>
	</div>
</header>
<div class="container container-main">
	<div class="row">
		<div class="col-8 col-content">
			<section class="tsd-panel tsd-comment">
				<div class="tsd-comment tsd-typography">
					<div class="lead">
						<p><code>ClassUtils</code> 是一个类工具类。</p>
					</div>
				</div>
			</section>
			<section class="tsd-panel tsd-hierarchy">
				<h3>Hierarchy</h3>
				<ul class="tsd-hierarchy">
					<li>
						<span class="target">ClassUtils</span>
					</li>
				</ul>
			</section>
			<section class="tsd-panel-group tsd-index-group">
				<h2>Index</h2>
				<section class="tsd-panel tsd-index-panel">
					<div class="tsd-index-content">
						<section class="tsd-index-section ">
							<h3>Methods</h3>
							<ul class="tsd-index-list">
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#createbyjson" class="tsd-kind-icon">create<wbr>ByJson</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#getclass" class="tsd-kind-icon">get<wbr>Class</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#getinstance" class="tsd-kind-icon">get<wbr>Instance</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#getregclass" class="tsd-kind-icon">get<wbr>Reg<wbr>Class</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#regclass" class="tsd-kind-icon">reg<wbr>Class</a></li>
								<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="_laya_utils_classutils_.classutils.html#regshortclassname" class="tsd-kind-icon">reg<wbr>Short<wbr>Class<wbr>Name</a></li>
							</ul>
						</section>
					</div>
				</section>
			</section>
			<section class="tsd-panel-group tsd-member-group ">
				<h2>Methods</h2>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="createbyjson" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> create<wbr>ByJson</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">create<wbr>ByJson<span class="tsd-signature-symbol">(</span>json<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, node<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, root<span class="tsd-signature-symbol">?: </span><a href="_laya_display_node_.node.html" class="tsd-signature-type">Node</a>, customHandler<span class="tsd-signature-symbol">?: </span><a href="_laya_utils_handler_.handler.html" class="tsd-signature-type">Handler</a>, instanceHandler<span class="tsd-signature-symbol">?: </span><a href="_laya_utils_handler_.handler.html" class="tsd-signature-type">Handler</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:112</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>根据指定的 json 数据创建节点对象。
										比如:
										{
										&quot;type&quot;:&quot;Sprite&quot;,
										&quot;props&quot;:{
										&quot;x&quot;:100,
										&quot;y&quot;:50,
										&quot;name&quot;:&quot;item1&quot;,
										&quot;scale&quot;:[2,2]
										},
										&quot;customProps&quot;:{
										&quot;x&quot;:100,
										&quot;y&quot;:50,
										&quot;name&quot;:&quot;item1&quot;,
										&quot;scale&quot;:[2,2]
										},
										&quot;child&quot;:[
										{
										&quot;type&quot;:&quot;Text&quot;,
										&quot;props&quot;:{
										&quot;text&quot;:&quot;this is a test&quot;,
										&quot;var&quot;:&quot;label&quot;,
										&quot;rumtime&quot;:&quot;&quot;
										}
										}
										]
									}</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>json: <span class="tsd-signature-type">any</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>json字符串或者Object对象。</p>
									</div>
								</li>
								<li>
									<h5><span class="tsd-flag ts-flagDefault value">Default value</span> node: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = null</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>node节点，如果为空，则新创建一个。</p>
									</div>
								</li>
								<li>
									<h5><span class="tsd-flag ts-flagDefault value">Default value</span> root: <a href="_laya_display_node_.node.html" class="tsd-signature-type">Node</a><span class="tsd-signature-symbol"> = null</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>根节点，用来设置var定义。</p>
									</div>
								</li>
								<li>
									<h5><span class="tsd-flag ts-flagDefault value">Default value</span> customHandler: <a href="_laya_utils_handler_.handler.html" class="tsd-signature-type">Handler</a><span class="tsd-signature-symbol"> = null</span></h5>
								</li>
								<li>
									<h5><span class="tsd-flag ts-flagDefault value">Default value</span> instanceHandler: <a href="_laya_utils_handler_.handler.html" class="tsd-signature-type">Handler</a><span class="tsd-signature-symbol"> = null</span></h5>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
							<p>生成的节点。</p>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="getclass" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Class</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">get<wbr>Class<span class="tsd-signature-symbol">(</span>className<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:59</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>根据名字返回类对象。</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>className: <span class="tsd-signature-type">string</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>类名(比如laya.display.Sprite)或者注册的别名(比如Sprite)。</p>
									</div>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
							<p>类对象</p>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="getinstance" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Instance</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">get<wbr>Instance<span class="tsd-signature-symbol">(</span>className<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:72</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>根据名称创建 Class 实例。</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>className: <span class="tsd-signature-type">string</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>类名(比如laya.display.Sprite)或者注册的别名(比如Sprite)。</p>
									</div>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
							<p>返回类的实例。</p>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="getregclass" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> get<wbr>Reg<wbr>Class</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">get<wbr>Reg<wbr>Class<span class="tsd-signature-symbol">(</span>className<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:50</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>返回注册的 Class 映射。</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>className: <span class="tsd-signature-type">string</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>映射的名字。</p>
									</div>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="regclass" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> reg<wbr>Class</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">reg<wbr>Class<span class="tsd-signature-symbol">(</span>className<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, classDef<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:30</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>注册 Class 映射，方便在class反射时获取。</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>className: <span class="tsd-signature-type">string</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>映射的名字或者别名。</p>
									</div>
								</li>
								<li>
									<h5>classDef: <span class="tsd-signature-type">any</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>类的全名或者类的引用，全名比如:&quot;laya.display.Sprite&quot;。</p>
									</div>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
						</li>
					</ul>
				</section>
				<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
					<a name="regshortclassname" class="tsd-anchor"></a>
					<h3><span class="tsd-flag ts-flagStatic">Static</span> reg<wbr>Short<wbr>Class<wbr>Name</h3>
					<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
						<li class="tsd-signature tsd-kind-icon">reg<wbr>Short<wbr>Class<wbr>Name<span class="tsd-signature-symbol">(</span>classes<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
					</ul>
					<ul class="tsd-descriptions">
						<li class="tsd-description">
							<aside class="tsd-sources">
								<ul>
									<li>Defined in laya/utils/ClassUtils.ts:38</li>
								</ul>
							</aside>
							<div class="tsd-comment tsd-typography">
								<div class="lead">
									<p>根据类名短名字注册类，比如传入[Sprite]，功能同regClass(&quot;Sprite&quot;,Sprite);</p>
								</div>
							</div>
							<h4 class="tsd-parameters-title">Parameters</h4>
							<ul class="tsd-parameters">
								<li>
									<h5>classes: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></h5>
									<div class="tsd-comment tsd-typography">
										<p>类数组</p>
									</div>
								</li>
							</ul>
							<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
						</li>
					</ul>
				</section>
			</section>
		</div>
		<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
			<nav class="tsd-navigation primary">
				<ul>
					<li class="globals  ">
						<a href="../globals.html"><em>Globals</em></a>
					</li>
					<li class="current tsd-kind-module">
						<a href="../modules/_laya_utils_classutils_.html">&quot;laya/utils/<wbr>Class<wbr>Utils&quot;</a>
					</li>
				</ul>
			</nav>
			<nav class="tsd-navigation secondary menu-sticky">
				<ul class="before-current">
				</ul>
				<ul class="current">
					<li class="current tsd-kind-class tsd-parent-kind-module">
						<a href="_laya_utils_classutils_.classutils.html" class="tsd-kind-icon">Class<wbr>Utils</a>
						<ul>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#createbyjson" class="tsd-kind-icon">create<wbr>ByJson</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#getclass" class="tsd-kind-icon">get<wbr>Class</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#getinstance" class="tsd-kind-icon">get<wbr>Instance</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#getregclass" class="tsd-kind-icon">get<wbr>Reg<wbr>Class</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#regclass" class="tsd-kind-icon">reg<wbr>Class</a>
							</li>
							<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
								<a href="_laya_utils_classutils_.classutils.html#regshortclassname" class="tsd-kind-icon">reg<wbr>Short<wbr>Class<wbr>Name</a>
							</li>
						</ul>
					</li>
				</ul>
				<ul class="after-current">
				</ul>
			</nav>
		</div>
	</div>
</div>
<footer>
	<div class="container">
		<h2>Legend</h2>
		<div class="tsd-legend-group">
			<ul class="tsd-legend">
				<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
				<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
				<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
			</ul>
		</div>
	</div>
</footer>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>